from django.db import models

# Create your models here.
class JiaoShi(models.Model):
    J_numb = models.CharField(max_length=16, verbose_name='序号')
    J_name = models.CharField(max_length = 16,verbose_name='教室名称')
    J_people =  models.CharField(max_length=16,verbose_name='人数')
    J_TF = models.BooleanField()
    img =  models.FileField(verbose_name='类别图片',upload_to='upload/img/')
    def J_LLJS(self):
        if self.J_TF:
            return '是理论教室'
        else:
            return '不是理论教室'
    J_LLJS.short_description = '是不是理论教室'
    def __str__(self):
        return "%s" % self.J_name

    class Meta :
        verbose_name_plural = "教室管理"
        verbose_name = "neirong"

class Property(models.Model):
    P_numb = models.CharField(max_length=16, verbose_name='序号')
    P_name = models.CharField(max_length = 16,verbose_name='资产名称')
    P_Jnumb = models.CharField(max_length=16, verbose_name='所属教室')
    P_img = models.FileField(verbose_name='类别图片',upload_to='upload/img/')
    P_TF = models.BooleanField()
    P_D = models.ForeignKey('JiaoShi', on_delete=models.CASCADE,default="")

    def P_Good(self):
        if self.P_TF:
            return '正常'
        else:
            return '不正常'
    P_Good.short_description = '是否正常'
    def __str__(self):
        return "%s" % self.P_name

    class Meta :
        verbose_name_plural = "资产管理"
        verbose_name = "内容"


class Clears(models.Model):
    C_numb = models.CharField(max_length=7, verbose_name='序号')
    C_name = models.CharField(max_length = 16,verbose_name='学生名称')
    C_TF = models.BooleanField()
    C_Clean = models.CharField(max_length=16, verbose_name='卫生情况')
    C_D = models.ForeignKey('JiaoShi', on_delete=models.CASCADE,default="")


    def C_Good(self):
        if self.C_TF:
            return '是教室卫生负责人'
        else:
            return '不是教室卫生负责人'
    C_Good.short_description = '是不是教室卫生负责人'
    def __str__(self):
        return "%s" % self.C_name

    class Meta :
        verbose_name_plural = "教室卫生管理"
        verbose_name = "内容"

